feat: add -up and -update flags for self-updating - #206
Open
root-Manas wants to merge 1 commit into
Open
root-Manas wants to merge 1 commit into
root-Manas wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved blocking issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Adds self-update support for simplehttpserver via -up and -update, updating the installed binary and exiting.
Changes:
- Registers both update aliases.
- Integrates the shared updater callback.
- Adds subprocess tests and documentation.
- Updates updater dependencies.
| File | Description |
|---|---|
README.md |
Documents update commands and aliases. |
internal/runner/update_test.go |
Tests successful and failed update checks. |
internal/runner/options.go |
Registers update flags. |
internal/runner/banner.go |
Integrates the updater callback. |
go.mod |
Adds the direct updater dependency. |
go.sum |
Records dependency checksums. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
-upand-updateto update the installed simplehttpserver binary to the latest release, then exit before starting a server. Both flags use ProjectDiscovery's existing shared updater, matching the callback pattern used in uncover.Fixes #155.
The README documents both flags.
utilswas already an indirect dependency; it is now direct at the same version, with the updater's transitive dependencies recorded bygo mod tidy.Subprocess tests exercise both aliases against mocked GitHub responses: an already-current release exits successfully, and a failed release lookup exits with an error. All four cases fail on unmodified
devbecause the flags are undefined. Tests make no external requests and do not replace an executable.Validation on Windows/amd64 with Go 1.27.0:
go test ./internal/runner -run TestUpdateFlags -count=1 -vgo test ./...go vet ./...go build -o ../artifacts/simplehttpserver.exe ./cmd/simplehttpserver-houtput lists both update aliases.